package com.d0324;

public class Sheep1 implements Cloneable{
    private String name;
    private int age;
    private Person person;

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    public Sheep1(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public static void main(String[] args) {
        Person o1= new Person("o1",13,"dalian");
        Person o2= new Person("o1",23,"tianjin");
        Sheep1 s1= new Sheep1("alice",12);
        try {

            Sheep1 duoli=(Sheep1)s1.clone();
            s1.setPerson(o2);
            System.out.println(s1.getPerson()==duoli.getPerson());
            //System.out.println(duoli.name+duoli.age);
            //System.out.println(s1.name==duoli.name);
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
    }
}
